<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">
    <body>
        <ui:composition template="../templates/default3.xhtml">  
            <ui:define name="left">
            </ui:define>
            <ui:define name="content">
                <h:form id="assignControl" binding="#{assignControlManagerBean.loadAssignControl}">
                    <p:messages id ="error" />
                    <p:panel header="Select role" id="selectControl">

                        <table>
                            <tr>
                                <td>Role:</td>
                                <td> 
                                    <b><h:outputText id="roleType" value="#{assignControlManagerBean.roleType}"/> </b> 
                                </td>
                            </tr>
                            <tr>
                                <td>Description:</td>
                                <td>
                                    <h:outputText id="description" value="#{assignControlManagerBean.description}"/>
                                </td>
                            </tr>
                        </table>
                    </p:panel>
                    <p:panel header="Manage role" id="rolesPanel">
                        <table class="panel"><tr><td align="center">
                                    <table>
                                        <tr>
                                            <td>
                                                Available controls
                                            </td>
                                            <td>
                                            </td>
                                            <td>
                                                Current controls
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <h:selectOneListbox value="#{assignControlManagerBean.selectAdd}" size="15" style="width:250px">
                                                    <f:selectItems value="#{assignControlManagerBean.controlsAvailable}"/>    
                                                </h:selectOneListbox>
                                                <f:selectItem itemLabel="Select One" itemValue=""/>  
                                            </td>
                                            <td valign ="top">
                                                <p:commandButton id="btnAddRole" styleClass="btnAssign" value="Add" actionListener="#{assignControlManagerBean.addControl}" ajax="true" update="assignControl"/>
                                                <br/>
                                                <p:commandButton id="btnRemoveRole"  styleClass="btnAssign" value="Remove" actionListener="#{assignControlManagerBean.removeControl}" update="assignControl" ajax="true"/>
                                            </td>
                                            <td>
                                                <h:selectOneListbox value="#{assignControlManagerBean.selectRemove}" size="15" style="width:250px">
                                                    <f:selectItems value="#{assignControlManagerBean.controlsCurrent}"/>    
                                                </h:selectOneListbox>
                                                <f:selectItem itemLabel="Select One" itemValue=""/>  
                                            </td>
                                        </tr>
                                    </table>
                                </td></tr>
                            <tr>
                                <td class="btn" colspan="3"><hr/>
                                    <p:commandButton id="btnDone" value="Done" actionListener="#{assignControlManagerBean.doneUpdate}" ajax="true" update="error"/>
                                </td>
                            </tr>
                        </table>
                    </p:panel>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>